#!/usr/bin/env python
# coding: utf-8
import os,sys
import web
from url import urls
from datetime import datetime

db = web.database(dbn='postgres', user='hjfx', pw='35836208', db='hjfx')

web.config.debug = True

config = web.storage(
    email='35836208@qq.com',
    site_name = '环境数据在线分析系统',
    site_desc = '',
    static = '/static',
)

perpage_count=15

app = web.application(urls, globals())

#wsgi要求绝对路径
current_file_path = os.path.dirname(__file__)
abspath = os.path.dirname(current_file_path)
#abspath = os.path.dirname('e:\\pyweb\\')
print "abspath:%s"%abspath
sys.path.append(abspath)
os.chdir(abspath)

session = web.session.Session(app, web.session.DiskStore('sessions'),initializer={'login_user_id':0,})  

render = web.template.render('templates/',base='layout', cache=False)

web.template.Template.globals['config'] = config
web.template.Template.globals['context'] = session
web.template.Template.globals['render'] = render
web.template.Template.globals['datetime'] = datetime

